function ShopService() {
  /** 审核门店类型 */
  this.dictShopType = {
    "01": "自然人",
    "02": "个体工商户",
    "03": "企业商户"
  };
  /**审核状态 */
  this.dictAuditStatus = {
    "1": "审批中",
    "2": "变更审批中",
    "3": "审批驳回",
    "4": "变更审批驳回",
    "5": "审批通过",
    "6": "变更审批通过"
  };

  /**
   * 获取门店审核状态显示名称
   */
  this.getAuditStatusTitle = function(val) {
    if (this.dictAuditStatus[val]) {
      return this.dictAuditStatus[val];
    }
    return "未知";
  };
  /**
   * 获取审核状态是否通过 true=通过,false=不通过
   * @param  val
   */
  this.getAuditIsPass = function(val) {
    return val == "5" || val=="6";
  };
  this.getAuditIsOpenAccount = function(val) {
    return val=='2' || val=='4' || this.getAuditIsPass(val);
  };
  /**
   * 是否审核失败
   * @param {*} val 
   */
  this.getAuditIsNoPass = function(val) {
    return val == "3" || val=="4";
  };
  /**
   * 获取门店审核状态是否允许编辑
   * @param {*} val 
   */
  this.getAuditIsEditShop=function(val){
    return this.getAuditIsPass(val) || val=='3' || val=='4';
  };

  this.getShopTypeTitle = function(val) {
    if (this.dictShopType[val]) {
      return this.dictShopType[val];
    }
    return '';
  };
  this.getShopTypeIndex = function(key) {
    if (this.dictShopType[key]) {
      var i = 0,
        flag = false;
      for (var item in this.dictShopType) {
        if (item == key) {
          flag = true;
          break;
        }
        i++;
      }
      if (flag) {
        return i;
      }
    }
    return 0;
  };
  this.getShopTypePickerData = function() {
    var ary = [];
    for (var i in this.dictShopType) {
      ary[ary.length] = {
        value: this.dictShopType[i],
        shopType: i
      };
    }
    return ary;
  };
}
var shopService = new ShopService();
export default shopService;
